package com.web.system.po;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.*;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

@Entity
@Table(name = "t_sys_role")
public class RolePo implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = -802601402785902868L;
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY) 
	@Column(name = "role_id")
	private Integer roleId;
	@Column(name = "role_name")
	private String roleName;
	@Column(name = "role_remark")
	private String roleRemark;
	private Integer isDelete;
	@ManyToMany
	@JoinTable(
	        name="t_sys_user_role",
	        joinColumns={@JoinColumn(name="role_id")},
	        inverseJoinColumns={@JoinColumn(name="user_id")}
	)
	@Fetch(value = FetchMode.SELECT)
	@LazyCollection(value = LazyCollectionOption.TRUE)
	private Set<UserPo> userBeans = new HashSet<UserPo>();
	@ManyToMany
	@JoinTable(
        name="t_sys_role_menu",
        joinColumns={@JoinColumn(name="role_id")},
        inverseJoinColumns={@JoinColumn(name="menu_id")}
	)
	@Fetch(value = FetchMode.SELECT)
	@LazyCollection(value = LazyCollectionOption.TRUE)
	private Set<TreeMenuPo> treeMenuPos = new HashSet<TreeMenuPo>();
	public Integer getRoleId() {
		return roleId;
	}
	public void setRoleId(Integer roleId) {
		this.roleId = roleId;
	}
	public String getRoleName() {
		return roleName;
	}
	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}
	public String getRoleRemark() {
		return roleRemark;
	}
	public void setRoleRemark(String roleRemark) {
		this.roleRemark = roleRemark;
	}
	public Integer getIsDelete() {
		return isDelete;
	}
	public void setIsDelete(Integer isDelete) {
		this.isDelete = isDelete;
	}
	public Set<UserPo> getUserBeans() {
		return userBeans;
	}
	public void setUserBeans(Set<UserPo> userBeans) {
		this.userBeans = userBeans;
	}
	public Set<TreeMenuPo> getTreeMenuPos() {
		return treeMenuPos;
	}
	public void setTreeMenuPos(Set<TreeMenuPo> treeMenuPos) {
		this.treeMenuPos = treeMenuPos;
	}
}
